/*
 * Token.h
 *
 *  Created on: 2010-4-28
 *      Author: Guobc
 */

#ifndef TOKEN_H_
#define TOKEN_H_

#include <string>
using namespace std;

namespace HA {

/**
 * A Token represents a word or symbol unit
 */
class Token {

public:
	/**
	 * Construct method
	 */
	Token() :
		mLine(0), mOffset(0), mType(0), mText("") {
	}

	Token(int line, int offset, int type, string text) :
		mLine(line), mOffset(offset), mType(type), mText(text) {

	}

	/**
	 * Set line number where is HTML
	 *
	 * @param line: the line number of HTML
	 */
	inline void setLine(int line) {
		mLine = line;
	}

	/**
	 * Get line number where is HTML
	 *
	 * @return the line number of HTML
	 */
	inline int getLine() const {
		return mLine;
	}

	/**
	 *Set offset where this token' position
	 *
	 *@param offset the position of HTML
	 */
	inline void setOffset(int offset) {
		mOffset = offset;
	}

	/**
	 * Get offset where this token's position
	 *
	 * @return the position of HTML
	 */
	inline int getOffset() const {
		return mOffset;
	}

	/**
	 * Set type
	 *
	 * @param type
	 */
	void setType(int type) {
		mType = type;
	}

	/**
	 * Get type
	 *
	 * @return
	 */
	inline int getType() const {
		return mType;
	}

	/**
	 * Set the token's text
	 *
	 * @param text
	 */
	void setText(string text) {
		mText = text;
	}

	/**
	 * Get the token's text
	 *
	 * @return
	 */
	inline string getText() const {
		return mText;
	}

private:
	int mLine;
	int mOffset;
	int mType;
	string mText;
};

}

#endif /* TOKEN_H_ */
